package com.example.admin_test.common.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Configuration;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Configuration
public class Result<T> {
    private int code;//返回码
    private String message;//返回描述
    private T data;//返回数据
    private Long count;//分页查询的总记录数

    public Result<Object> success(){
        return new Result(0,"登陆成功",data,null);
    }
    public Result<Object> success(Object data){
        return new Result(0,"登陆成功",data,null);
    }
    public Result<Object> success(Object data,Long count){
        return new Result(0,"登陆成功",data,count);
    }
    public Result<Object> success(String message){
        return new Result(0,message,data,count);
    }

    public Result<Object> fail(){
        return new Result(400,"登陆失败",null,null);
    }
    public Result<Object> fail(String fail){
        return new Result(400,fail,null,null);
    }


}
